package mvc.binalee.handler;

import java.util.ArrayList;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import mvc.binalee.models.CommentBean;
import mvc.binalee.models.CommentDataAccesser;
import mvc.binalee.models.DataAccesser;
import mvc.binalee.models.DataBean;

public class CommentHandler implements Handler {

	@Override
	public String doIt(HttpServletRequest request, HttpServletResponse response) {
		ArrayList<CommentBean> list = null;
		CommentDataAccesser cda = new CommentDataAccesser();
		
		String paramArticleNumber = request.getParameter("articleNumber");
		String categoryCode = request.getParameter("categoryCode");
		
		int articleNumber = 0;
		
//=========================================================================	
		
		if(paramArticleNumber != null)
			articleNumber = Integer.parseInt(paramArticleNumber);
		else
			articleNumber = 1;
		
			
		
		list = cda.getCommnets(articleNumber, categoryCode);

		request.setAttribute("commentList", list);
		
		return "/bbs/comment.jsp";
	}

}
